/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) "../variables";
@import (reference) "../mixins";
@import (reference) "../init/links";

.sonar-d3 .treemap-container {
  position: relative;
}

.sonar-d3 .treemap-cell {
  position: absolute;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  box-sizing: border-box;
  text-align: center;
}

.sonar-d3 .treemap-inner {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.2;
  padding: 5px;
  box-sizing: border-box;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sonar-d3 .treemap-link {
  position: absolute;
  z-index: @treemap-link-z-index;
  top: 5px; right: 5px;
  line-height: @iconSmallFontSize;
  opacity: 0.5;
  .link-no-underline;

  &:hover { opacity: 1; }
}

.sonar-d3 .treemap-link i,
.sonar-d3 .treemap-link i:before {
  vertical-align: top;
  font-size: inherit;
  line-height: inherit;
}

.sonar-d3 .treemap-cell-small {
  .treemap-inner { display: none; }
}

.sonar-d3 .treemap-cell-very-small {
  .treemap-inner { display: none; }
  .treemap-link { display: none; }
}

.sonar-d3 .treemap-breadcrumbs {
  margin-top: 10px;
  padding-top: 7px;
  border-top: 1px solid #e6e6e6;
  line-height: 1.3;
}

.sonar-d3 .treemap-breadcrumbs-item {
  color: @secondFontColor;

  & > [class^="icon-qualifier-"] { margin-right: 4px; }
}

.sonar-d3 .treemap-breadcrumbs-item + .treemap-breadcrumbs-item {
  margin-left: 10px;

  & > .icon-chevron-right { margin-right: 10px; }
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;

  a {
    padding: 5px;
    .link-no-underline;
  }
}

/*
 * Line Chart
 */
@defaultSerieColor: @darkBlue;
@serieColor1: @blue;
@serieColor2: #24c6e0;

.line-chart {
}

.line-chart-path {
  fill: none;
  stroke: @defaultSerieColor;
  stroke-width: 2px;

  &.line-chart-path-1 {
    stroke: @serieColor1;
  }

  &.line-chart-path-2 {
    stroke: @serieColor2;
  }

  &:hover {
    z-index: 120;
  }
}

.line-chart-area {
  fill: fade(@defaultSerieColor, 30%);
  stroke-width: 0;

  &.line-chart-area-1 {
    fill: fade(@serieColor1, 30%);
  }

  &.line-chart-area-2 {
    fill: fade(@serieColor2, 30%);
  }
}

.line-chart-legend {
  color: @defaultSerieColor;

  &.line-chart-legend-1 {
    color: @serieColor1;
  }

  &.line-chart-legend-2 {
    color: @serieColor2;
  }
}

.line-chart-point {
  fill: #fff;
  stroke: @defaultSerieColor;
  stroke-width: 2px;
}

.line-chart-event {
  fill: #fff;
  stroke: @defaultSerieColor;
  stroke-width: 2px;

  &.VERSION {
    stroke: @blue;
  }

  &.QUALITY_GATE {
    stroke: @green;
  }

  &.QUALITY_PROFILE {
    stroke: @orange;
  }

  &.OTHER {
    stroke: @purple;
  }
}

.line-chart-backdrop {
}

.line-chart-tick {
  fill: @secondFontColor;
  font-size: 12px;
  text-anchor: middle;
}

.line-chart-tick-x {
  text-anchor: end;
}

.line-chart-tick-x-right {
  text-anchor: start;
}

.line-chart-grid {
  shape-rendering: crispedges;
  stroke: #eee;
}

/*
 * Bubble Chart
 */

.bubble-chart {
}

.bubble-chart-bubble {
  fill: @blue;
  fill-opacity: 0.2;
  stroke: @blue;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    fill-opacity: 0.8;
  }
}

.bubble-chart-grid {
  shape-rendering: crispedges;
  stroke: #eee;
}

.bubble-chart-tick {
  fill: @secondFontColor;
  font-size: 12px;
  text-anchor: middle;
}

.bubble-chart-tick-y {
  text-anchor: end;
}

/*
 * Bar Chart
 */
.bar-chart {
}

.bar-chart-bar {
  fill: @blue;
}

.bar-chart-tick {
  fill: @secondFontColor;
  font-size: 12px;
  text-anchor: middle;
}

.histogram-tick {
  text-anchor: end;
}

.histogram-value {
  text-anchor: start;
}

/*
 * Charts zooming
 */

.chart-zoomed {
  .line-chart-area {
    clip-path: url(#chart-clip);
  }

  .line-chart-path {
    clip-path: url(#chart-clip);
  }

  .leak-chart-rect {
    clip-path: url(#chart-clip);
  }
}

.chart-zoom-tick {
  fill: @secondFontColor;
  font-size: 10px;
  text-anchor: middle;
}

.chart-wheel-zoom-overlay {
  fill: none;
  stroke: none;
  pointer-events: all;
}

.chart-zoom {

  .zoom-overlay{
    fill: none;
    stroke: none;
    cursor: crosshair;;
    pointer-events: all;
  }

  .zoom-selection {
    fill: @secondFontColor;
    fill-opacity: 0.2;
    stroke: @secondFontColor;
    shape-rendering: crispEdges;
    cursor: move;
  }

  .zoom-selection-handle {
    cursor: ew-resize;
    fill-opacity: 0;
    stroke: none;
  }
}
